package com.example.online_order.config;


import com.example.online_order.interceptor.AuthInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class InterceptorConfog implements WebMvcConfigurer {
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new AuthInterceptor())
                .addPathPatterns("/**")//拦截所有请求
                .excludePathPatterns("/login")//放行注册和登录
                .excludePathPatterns("/client/regist")
                .excludePathPatterns("/files/download")
                .excludePathPatterns("/files/upload");


    }


}
